﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuTouTiaoAssist
{
    public partial class FrmOkCancelBase : FrmBase
    {
        private bool m_isCancelButtonVisible = true;

        public bool IsCancelButtonVisible
        {
            get { return m_isCancelButtonVisible; }
            set
            {
                m_isCancelButtonVisible = value;
                this.btnCancel.Visible = value;
            }
        }

        public FrmOkCancelBase()
        {
            InitializeComponent();
            //base.EnableCancelButton();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            //this.CancelButton.PerformClick();
            ReturnCancel();
        }

        protected void ReturnOk()
        {
            if (this.Modal)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.Close();
            }
        }

        protected void ReturnCancel()
        {
            if (this.Modal)
            {
                this.DialogResult = DialogResult.Cancel;
            }
            else
            {
                this.Close();
            }
        }
    }
}
